<!--
  ~  Copyright (C) 2020 justlive1
  ~
  ~  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  ~  in compliance with the License. You may obtain a copy of the License at
  ~
  ~  http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~  Unless required by applicable law or agreed to in writing, software distributed under the License
  ~  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  ~  or implied. See the License for the specific language governing permissions and limitations under
  ~  the License.
  -->

<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta content="IE=edge" http-equiv="X-UA-Compatible">
  <title>Easy Proxy</title>

  <link href="${ctx}/public/css/index.css" rel="stylesheet">
  <link href="${ctx}/public/layui/2.5.5/css/layui.css" rel="stylesheet">
</head>
<body>
<div class="login-frame">
  <div class="layui-card">
    <div class="layui-card-header">
      <h2>Easy Proxy</h2>
    </div>
    <form class="layui-card-body layui-form">
      <div class="layui-form-item">
        <label class="label-fixed-icon layui-icon layui-icon-username"
               for="user-login-username"></label>
        <input class="input-fixed-icon layui-input" id="user-login-username" lay-verify="required"
               name="username"
               placeholder="用户名" type="text">
      </div>
      <div class="layui-form-item">
        <label class="label-fixed-icon layui-icon layui-icon-password"
               for="user-login-password"></label>
        <input class="input-fixed-icon layui-input" id="user-login-password" lay-verify="required"
               name="password"
               placeholder="密码" type="password">
      </div>
      <div class="layui-form-item">
        <button class="layui-btn layui-btn-fluid" lay-filter="login" lay-submit>登入</button>
      </div>
    </form>
  </div>

  <div class="">
    <p>
      © 2020 <a href="http://www.justlive.vip/" target="_blank">justlive.vip</a>
    </p>
  </div>
</div>

<script src="${ctx}/public/layui/2.5.5/layui.js" type="text/javascript"></script>
<script type="text/javascript">
  layui.use('form', function () {
    layui.form.on('submit(login)', function (data) {
      layui.$.post("${ctx}/login", data.field, function (resp) {
        if (resp.success) {
          location.reload();
        } else {
          layer.alert(resp.message);
        }
      });
      return false;
    });
  });
</script>
</body>
</html>